import { reactive } from "vue"

export type SafeArea = {
  top : number,
  right : number,
  bottom : number,
  left : number,
  width : number,
  height : number,
}

type State = {
  lifeCycleNum : number,
  // 状态栏高度
  statusBarHeight : number,
  safeArea : SafeArea
  // 设备像素比
  devicePixelRatio : number
}

export const state = reactive({
  lifeCycleNum: 0,
  statusBarHeight: 0,
  devicePixelRatio: 1,
  safeArea: {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    width: 0,
    height: 0,
  }
} as State)

export const setLifeCycleNum = (num : number) => {
  state.lifeCycleNum = num
}

export const setStatusBarHeight = (height : number) => {
  state.statusBarHeight = height
}

export const setSafeArea = (value : SafeArea) => {
  state.safeArea = value
}

export const setDevicePixelRatio = (devicePixelRatio : number) => {
  state.devicePixelRatio = devicePixelRatio
}
